﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Card.aspx.cs" Inherits="UI.Card" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="format-detection" content="telephone=no"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <style>
        .cardlist{width:calc(100% - 20px); background-color: #ffffff; padding:10px; display: flex; flex-direction: row; justify-content: space-between;}
		.cardlist .card{width:45%;}
        .cardlist .card img{width:100%;}
		.cardlist .card:active{opacity: 0.6;}
        .hidden{display:none;}
    </style>
</head>
<body>
    <div>
        <div class="cardlist border-b">
			<div id="drivecard1" class="card" onclick="ChooseDriverImg()"><img src="https://xipingzhifa.qiyedaishu.com/img/drivecard.png" /></div>
			<div id="drivecard2" class="card hidden" onclick="ChooseDriverImg()"><img src="" /></div>
			<div id="idcard1" class="card" onclick="ChooseIDCardImg()"><img src="https://xipingzhifa.qiyedaishu.com/img/idcard.png" /></div>
			<div id="idcard2" class="card hidden" onclick="ChooseIDCardImg()"><img src="" /></div>
		</div>
        <iframe id="iframe" src="http://xipingzhifa.qiyedaishu.com/a.html?v=1"></iframe>
    </div>
    <script>
        window.addEventListener('message', function (e) {
            console.log(e);
            var fun=e.data;
            if(fun=="click"){
                alert("aaa");    
            };
        });
        wx.config({
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: '<%=appid%>', // 必填，公众号的唯一标识
            timestamp: '<%=timestamp %>', // 必填，生成签名的时间戳
            nonceStr: '<%=noncestr %>', // 必填，生成签名的随机串
            signature: '<%=signature %>', // 必填，签名，见附录1
            jsApiList: [
            'checkJsApi',
            "chooseImage",
            "uploadImage",
            "downloadImage",
            "previewImage"
            ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
        });

        function ChooseDriverImg() {
            wx.chooseImage({
                count: 1, // 默认9
                sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
                sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机，默认二者都有
                success: function (res) {
                    var localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
                    $("#drivecard2").html('<img src="' + localIds[0] + '">');
                    ischooseimg = true;
                    wx.uploadImage({
                        localId: localIds[0], // 需要上传的图片的本地ID，由chooseImage接口获得
                        isShowProgressTips: 1, // 默认为1，显示进度提示
                        success: function (res) {
                            var serverId = res.serverId; // 返回图片的服务器端ID
                            window.parent.postMessage(serverId, '*');
                        }
                    });
                }
            });
        }
    </script>
</body>
</html>